package com.nacos.temp3.client.fallback;

import com.nacos.temp3.client.service.OrderApiClient;
import com.nacos.temp3.support.domain.Product;
import com.nacos.temp3.support.response.BaseResponse;
import com.nacos.temp3.support.response.BaseResult;
import com.nacos.temp3.support.response.ReturnEnum;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

@Slf4j
public class OrderApiFallback implements OrderApiClient {

    @Override
    public BaseResult<List<Product>> productList() {
        log.error("远程服务降级执行。\r\n\r\tat {}", Thread.currentThread().getStackTrace()[1].toString());
        return BaseResponse.error(ReturnEnum.ERROR, new ArrayList<>());
    }

    @Override
    public BaseResult<Product> get(Object primaryKey) {
        log.error("远程服务降级执行。\r\n\r\tat {}", Thread.currentThread().getStackTrace()[1].toString());
        return null;
    }

}
